package broadcast;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.example.administrator.newxlmedical.CountActivity;

import baseinterface.UsbDeal;
import constants.Constants;

/**
 * Created by Administrator on 2018/11/7.
 */

public class UsbBroadcast extends BroadcastReceiver {
    public UsbDeal usbDeal;

    @Override
    public void onReceive(Context context, Intent intent) {
        usbDeal = CountActivity.usbDeal;
        switch (intent.getAction()) {

            case Intent.ACTION_MEDIA_MOUNTED: {
                Constants.IS_MOUNTED = true;
                if (usbDeal!= null) {
                    usbDeal.mounted();
                }
                break;
            }
            case Intent.ACTION_MEDIA_UNMOUNTED: {
                Constants.IS_MOUNTED = false;
                if (usbDeal!= null) {
                    usbDeal.unMounted();
                }
                break;
            }
            default:
                break;
        }
    }
}
